package com.caine.androidtask.ls08;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.caine.androidtask.R;

public class Ls08 extends Activity implements OnClickListener {

	private Button btn_alert;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.caine_ls08);
		init();
		
	//	=================================
		/**		 AlertDialog.Builder b = new AlertDialog.Builder(this);
				 final AlertDialog d = b.create();
        b.setCancelable(true);
        b.setTitle("TYPE_SYSTEM_ALERT");
        b.setMessage("DialogAlert");
        b.setPositiveButton("",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                   d.dismiss();
                }
        });     
        
        d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        d.show();*/
		
		
		
	}

	void init() {
		btn_alert = (Button) findViewById(R.id.btn_alertdialog);
		btn_alert.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
		AlertDialog.Builder dialog = new AlertDialog.Builder(this);
		dialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				// TODO Auto-generated method stub
				dialog.dismiss();
			}
		});	 
		dialog.setMessage("power over!!!");
		dialog.create();
		dialog.show();
	}
}